package com.dreamcar.auction.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * CarModel entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "car_model", catalog = "assignment")
public class CarModel implements java.io.Serializable {

	// Fields

	private Integer idCarModel;
	private String model;
	private Set<DestinationMarket> destinationMarkets = new HashSet<DestinationMarket>(
			0);
	private Set<Component> components = new HashSet<Component>(0);

	// Constructors

	/** default constructor */
	public CarModel() {
	}

	/** minimal constructor */
	public CarModel(Integer idCarModel) {
		this.idCarModel = idCarModel;
	}

	/** full constructor */
	public CarModel(Integer idCarModel, String model,
			Set<DestinationMarket> destinationMarkets, Set<Component> components) {
		this.idCarModel = idCarModel;
		this.model = model;
		this.destinationMarkets = destinationMarkets;
		this.components = components;
	}

	// Property accessors
	@Id
	@Column(name = "ID_CAR_MODEL", unique = true, nullable = false)
	public Integer getIdCarModel() {
		return this.idCarModel;
	}

	public void setIdCarModel(Integer idCarModel) {
		this.idCarModel = idCarModel;
	}

	@Column(name = "MODEL", length = 45)
	public String getModel() {
		return this.model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "carModels")
	public Set<DestinationMarket> getDestinationMarkets() {
		return this.destinationMarkets;
	}

	public void setDestinationMarkets(Set<DestinationMarket> destinationMarkets) {
		this.destinationMarkets = destinationMarkets;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "carModels")
	public Set<Component> getComponents() {
		return this.components;
	}

	public void setComponents(Set<Component> components) {
		this.components = components;
	}

}